/* Window client-side decorations and extra slots
 * Includes swallows for:
 *  - app content
 *  - main menu
 *  - indicator
 *  - soft key
 *  - virtual keyboard
 */

group { name: "elm/border/base/default";
   images.image: "win_shad_flat.png" COMP;
   data.item: "shadow" "1";
   data.item: "version" "119";
#define BORDERLESS  1
#define MAXIMIZED   2
#define UNRESIZABLE 4
#define SET_MODE(a) script { new m = get_int(border_mode); m |= (a); set_int(border_mode, m); eval_mode(m); }
#define UNSET_MODE(a) script { new m = get_int(border_mode); m &= ~(a); set_int(border_mode, m); eval_mode(m); }

#define INDICATOR_TYPE_UNKNOWN 0
#define INDICATOR_TYPE_BG_OPAQUE 1
#define INDICATOR_TYPE_BG_TRANSPARENT 2
#define INDICATOR_TYPE_HIDDEN 3
   script {
      public hide_shadow;
      public show_menu;
      public eval_shadow_menu() {
         new m_show = get_int(show_menu);
         new s_hide = get_int(hide_shadow);

         if (s_hide) {
            set_state(PART:"shadow_clip", "hidden", 0.0);
            set_state(PART:"shadow_base", "hidden", 0.0);
         } else {
            set_state(PART:"shadow_clip", "default", 0.0);
            set_state(PART:"shadow_base", "default", 0.0);
         }
         if ((m_show)/* && (s_hide)*/) {
            set_state(PART:"elm.swallow.menu", "visible", 0.0);
         } else {
            set_state(PART:"elm.swallow.menu", "default", 0.0);
         }
      }

      public border_mode;
      public indicator_type = 0;
      public indicator_enabled = 0;
      public eval_mode(m) {
         if (m & (BORDERLESS | MAXIMIZED | UNRESIZABLE)) {
            set_state(PART:"bottom_clip", "hidden", 0.0);
            set_state(PART:"top_resize_clip", "hidden", 0.0);
         } else {
            set_state(PART:"bottom_clip", "default", 0.0);
            set_state(PART:"top_resize_clip", "default", 0.0);
         }
      }
   }
   parts {
      /* opaque region of the window, to inform the compositor */
      spacer { "elm.spacer.opaque";
         desc {
            rel1.to: "top_clip";
            rel2.to: "bottom_clip";
         }
         desc { "max"; inherit: "default"; }
      }
      /* covers the entire client contents, excluding the main menu */
      spacer { "elm.spacer.content";
         required; // since 1.19
         desc {
            rel1.to: "elm.swallow.menu";
            rel1.relative: 0.0 1.0;
            rel2.to: "elm.swallow.keyboard";
            rel2.relative: 1.0 0.0;
         }
      }
      part { name: "shadow_clip"; type: RECT; mouse_events: 0;
         clip_to: "shadow_clip2";
         description { state: "default";
            rel.to: "_sh1";
            color_class: "/shadow/normal/border";
         }
         description { state: "hidden"; inherit;
            visible: 0;
         }
         description { state: "focused";
            inherit: "default";
            color_class: "/shadow/selected/border";
         }
      }
      part { name: "shadow_clip2"; type: RECT; mouse_events: 0;
         description { state: "default";
            rel.to: "shadow_clip";
         }
         description { state: "hidden";
            visible: 0;
         }
      }
      part { name: "shadow_base"; type: SPACER;
         scale: 1;
         description { state: "default" 0.0;
            WIN_SHADOW_SPACER;
         }
         desc { "hidden";
            rel1.offset: 0 0;
            rel2.offset: -1 -1;
         }
      }
      WIN_SHAD("shadow_base", "shadow_clip", "win_shad_flat.png", 21, 21, 14, 28, 0.5)
      /* window background: solid color */
      rect { "bg_clip"; nomouse;
         desc { "default";
            rel1.to: "top_clip";
            rel1.relative: 0.0 1.0;
            rel2.to: "bottom_clip";
         }
      }
      rect { "elm.rect.background";
         required; // @since 1.19
         clip: "bg_clip";
         desc { "default";
            color_class: "/bg/normal/background";
            visible: 0;
            rel.to: "elm.spacer.content";
         }
         desc { "visible";
            inherit: "default";
            visible: 1;
         }
      }
      /* window background: image */
      swallow { "elm.swallow.background";
         required; // @since 1.19
         clip: "client_clip";
         desc { "default";
            rel.to: "elm.spacer.content";
         }
      }
      spacer { "indicator_spacer";
         desc { "default";
            rel.to: "elm.swallow.indicator";
         }
         desc { "hidden";
            rel.to: "top_clip";
            rel1.relative: 0.0 1.0;
            align: 0.5 0.0;
            fixed: 1 1;
         }
      }

      /* main menu */
      rect { "menu_bg";
         desc { "default";
            color_class: "/bg/normal/menu";
            align: 0.5 0.0;
            rel.to: "elm.swallow.menu";
            fixed: 1 1;
            visible: 0;
         }
      }
      swallow { "elm.swallow.menu";
         required: 1; // since 1.19
         desc { "default";
            rel.to: "top_clip";
            visible: 0;
            align: 0.5 1.0;
            fixed: 1 1;
            rel2.relative: 1.0 1.0;
            rel1.offset: 0 -1;
// debug...
//min:  0 40;
         }
         desc { "visible"; inherit: "default";
            // GGGG
            rel1.offset: 0 0;
            align: 0.5 0.0;
            visible: 1;
            fixed: 0 1;
         }
      }

      /* application contents - spacer and clipper (without main menu) */
      spacer { "client_spacer";
         desc { "default";
            rel1.to: "elm.swallow.menu";
            rel1.relative: 0.0 1.0;
            rel2.to: "elm.swallow.keyboard";
            rel2.relative: 1.0 0.0;
         }
      }
      rect { "client_clip";
         desc { "default";
            rel.to: "client_spacer";
         }
      }

      /* application contents */
      swallow { "elm.swallow.client";
         clip: "client_clip";
         desc { "default";
            rel.to: "client_clip";
         }
      }

      /* modal window blocker */
      rect { "elm.rect.blocker";
         required;
         desc { "default";
            rel1.to: "top_clip";
            rel1.relative: 0.0 1.0;
            rel2.to: "bottom_clip";
            rel2.relative: 1.0 0.0;
            color_class: "/bg/normal/win-blocker";
            hid;
         }
         desc { "visible";
            inherit: "default";
            vis;
         }
      }

      /* top title bar - spacer and clipper */
      rect { "top_clip"; //nomouse;
         scale: 1;
         desc { "default";
            rel1.to: "shadow_base";
            rel2.to_x: "shadow_base";
            rel2.to_y: "elm.text.title";
            rel2.offset: -1 2;
            vis;
            offscale;
         }
         desc { "hidden";
            inherit: "default";
            rel1.to: "";
            rel2.to: "";
            rel1.relative: 0.0 0.0;
            rel1.offset: 0 -1;
            rel2.to: "shadow_base";
            rel2.relative: 1.0 0.0;
            rel2.offset: -1 -1;
            max: -1 0;
            min: 0 0;
            fixed: 0 1;
            hid;
         }
      }
      /* top title bar */
      part { name: "top"; type: RECT; mouse_events: 0;
         clip: "top_clip";
         description { state: "default" 0.0;
            rel.to: "top_clip";
            color_class: "/bg/normal/titlebar";
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            color_class: "/bg/selected/titlebar";
         }
      }
      part { name: "elm.text.title"; type: TEXT; mouse_events: 0;
         scale: 1;
         clip: "top_clip";
         description { state: "default" 0.0;
            rel1.relative: 1.0 0.0;
            rel1.offset: 1 4;
            rel1.to_x: "icon";
            rel1.to_y: "shadow_base";
            rel2.relative: 0.0 0.0;
            rel2.offset: -2 4;
            rel2.to_x: "elm.event.minimize";
            rel2.to_y: "shadow_base";
            align: 0.5 0.0;
            color_class: "/fg/noemal/titlebar";
            min: 0 16;
            text { font: FNBD; size: 10;
               text_class: "title_bar";
               align: 0.5 0.0;
               min: 0 1;
            }
            fixed: 0 1;
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/titlebar";
         }
      }
      spacer {  "icon";
         desc { "default";
            rel.to: "elm.event.icon";
         }
         desc { "bounce1";
            inherit: "default";
            rel1.relative: 0.5 0.5;
            rel2.relative: 0.5 0.5;
         }
         desc { "bounce2";
            inherit: "default";
            rel1.relative: -0.5 -0.5;
            rel2.relative: 1.2 1.2;
         }
      }
      swallow {  "elm.swallow.icon"; nomouse;
         clip_to: "top_clip";
         desc { "default";
            rel1.to: "icon";
            rel1.relative: 0.15 0.15;
            rel2.to: "icon";
            rel2.relative: 0.85 0.85;
            rel2.offset: 0 0;
         }
      }
      rect {  "clip1"; nomouse;
         desc { "default";
            rel.to: "top_clip";
         }
         desc { "focused";
            inherit: "default";
            visible: 0;
         }
      }
      rect {  "clip2"; nomouse;
         desc { "default";
            rel.to: "top_clip";
            visible: 0;
         }
         desc { "focused";
            inherit: "default";
            visible: 1;
         }
      }
      image { "close1";  nomouse;
         clip: "clip1";
         scale: 1;
         desc { "default";
            image.normal: "i-close";
            rel.to: "elm.event.close";
            min: 15 15; max: 15 15;
            fixed: 1 1;
            color_class: "/fg/noemal/titlebar/close";
         }
         desc { "selected";
            inherit: "default";
            color_class: "/fg/pressed/titlebar/close";
         }
      }
      image { "max1"; nomouse;
         clip: "clip1";
         scale: 1;
         desc { "default";
            image.normal: "i-arrow-u";
            rel.to: "elm.event.maximize";
            min: 15 15; max: 15 15;
            fixed: 1 1;
            color_class: "/fg/noemal/titlebar/maximize";
         }
         desc { "selected";
            inherit: "default";
            color_class: "/fg/pressed/titlebar/maximize";
         }
      }
      image { "min1"; nomouse;
         clip: "clip1";
         scale: 1;
         desc { "default";
            image.normal: "i-arrow-d";
            rel.to: "elm.event.minimize";
            min: 15 15; max: 15 15;
            fixed: 1 1;
            color_class: "/fg/normal/titlebar/minimize";
         }
         desc { "selected";
            inherit: "default";
            color_class: "/fg/pressed/titlebar/minimize";
         }
      }
      image { "close2";  nomouse;
         clip: "clip2";
         scale: 1;
         desc { "default";
            image.normal: "i-close";
            rel.to: "elm.event.close";
            min: 15 15; max: 15 15;
            fixed: 1 1;
            color_class: "/fg/selected/titlebar/close";
         }
         desc { "selected";
            inherit: "default";
            color_class: "/fg/selected-pressed/titlebar/close";
         }
      }
      image { "max2"; nomouse;
         clip: "clip2";
         scale: 1;
         desc { "default";
            image.normal: "i-arrow-u";
            rel.to: "elm.event.maximize";
            min: 15 15; max: 15 15;
            fixed: 1 1;
            color_class: "/fg/selected/titlebar/maximize";
         }
         desc { "selected";
            inherit: "default";
            color_class: "/fg/selected-pressed/titlebar/maximize";
         }
      }
      image { "min2"; nomouse;
         clip: "clip2";
         scale: 1;
         desc { "default";
            image.normal: "i-arrow-d";
            rel.to: "elm.event.minimize";
            min: 15 15; max: 15 15;
            fixed: 1 1;
            color_class: "/fg/selected/titlebar/minimize";
         }
         desc { "selected";
            inherit: "default";
            color_class: "/fg/selected-pressed/titlebar/minimize";
         }
      }
      rect {  "elm.event.icon";
         desc { "default";
            rel1.relative: 0.0 0.0;
            rel1.to: "top_clip";
            rel2.relative: 0.0 1.0;
            rel2.to: "top_clip";
            align: 0.0 0.5;
            aspect: 1.0 1.0; aspect_preference: VERTICAL;
            color: 0 0 0 0; // no cc
         }
      }
      rect {  "elm.event.titlebar";
         desc { "default";
            rel1.relative: 1.0 0.0;
            rel1.to_x: "elm.event.icon";
            rel1.to_y: "top_clip";
            rel2.relative: 0.0 1.0;
            rel2.offset: 0 -1;
            rel2.to_x: "elm.event.minimize";
            rel2.to_y: "top_clip";
            color: 0 0 0 0; // no cc
         }
      }
      rect {  "elm.event.close";
         desc { "default";
            rel.to: "top_clip";
            rel1.relative: 1.0 0.0;
            rel2.relative: 1.0 1.0;
            align: 1.0 0.5;
            aspect: 1.0 1.0; aspect_preference: VERTICAL;
            color: 0 0 0 0; // no cc
         }
      }
      rect {  "elm.event.maximize";
         desc { "default";
            rel1.relative: -0.25 0.0;
            rel1.offset: -1 0;
            rel1.to_x: "elm.event.close";
            rel1.to_y: "top_clip";
            rel2.relative: -0.25 1.0;
            rel2.to_x: "elm.event.close";
            rel2.to_y: "top_clip";
            align: 1.0 0.5;
            aspect: 1.0 1.0; aspect_preference: VERTICAL;
            color: 0 0 0 0; // no cc
         }
      }
      rect {  "elm.event.minimize";
         desc { "default";
            rel1.relative: 0.0 0.0;
            rel1.offset: -1 0;
            rel1.to_x: "elm.event.maximize";
            rel1.to_y: "top_clip";
            rel2.relative: 0.0 1.0;
            rel2.to_y: "top_clip";
            rel2.to_x: "elm.event.maximize";
            align: 1.0 0.5;
            aspect: 1.0 1.0; aspect_preference: VERTICAL;
            color: 0 0 0 0; // no cc
         }
      }
      rect { "top_resize_clip";
         clip: "top_clip";
         desc { "default";
            rel.to: "top_clip";
         }
         desc { "hidden";
            inherit: "default";
            hid;
         }
      }
      rect {  "elm.event.resize.tl";
         clip: "top_resize_clip";
         scale: 1;
         desc { "default";
            rel.to: "top_clip";
            rel2.relative: 0.0 0.0;
            rel2.offset: 31 3;
            min: RSZMINW RSZMINH;
            align: 1.0 1.0;
            color: RSZCOL; // no cc
            fixed: 1 1;
         }
         desc { "hidden"; inherit: "default"; hid; }
      }
      rect {  "elm.event.resize.t";
         clip: "top_resize_clip";
         scale: 1;
         desc { "default";
            rel1.to: "elm.event.resize.tl";
            rel1.relative: 1.0 0.0;
            rel2.to: "elm.event.resize.tr";
            rel2.relative: 0.0 1.0;
            min: 0 RSZMINH;
            align: 0.5 1.0;
            color: RSZCOL2; // no cc
            fixed: 1 1;
         }
         desc { "hidden"; inherit: "default"; hid; }
      }
      rect {  "elm.event.resize.tr";
         clip: "top_resize_clip";
         scale: 1;
         desc { "default";
            rel.to: "top_clip";
            rel1.relative: 1.0 0.0;
            rel1.offset: -32 0;
            rel2.relative: 1.0 0.0;
            rel2.offset: -1 3;
            min: RSZMINW RSZMINH;
            align: 0.0 1.0;
            color: RSZCOL; // no cc
            fixed: 1 1;
         }
         desc { "hidden"; inherit: "default"; hid; }
      }
      /* bottom border - spacer and clipper */
      swallow { "elm.swallow.keyboard";
         desc { "default";
           rel.to: "bottom_clip";
           rel2.relative: 1.0 0.0;
           align: 0.0 1.0;
           fixed: 0 1;
         }
      }
      rect { "bottom_clip";
         scale: 1;
         desc { "default";
            rel.to: "shadow_base";
            rel1 { relative: 0.0 1.0; offset: 0 -1; }
            align: 0.0 1.0;
            min: 0 5;
            fixed: 0 1;
         }
         desc { "hidden";
            inherit: "default";
            rel1 { relative: 0.0 1.0; offset: 0 0; }
            rel2 { relative: 1.0 1.0; offset: -1 0; }
            min: 0 0;
            hid;
         }
      }
      part { name: "bottom"; type: RECT; mouse_events: 0;
         clip: "bottom_clip";
         description { state: "default" 0.0;
            color_class: "/bg/normal/border";
            rel.to: "bottom_clip";
         }
         description { state: "focused" 0.0;
            inherit: "default";
            color_class: "/bg/selected/border";
         }
      }

      rect {  "elm.event.resize.bl";
         clip: "bottom_clip";
         scale: 1;
         desc { "default";
            rel.to: "bottom_clip";
            rel2.relative: 0.0 1.0;
            rel2.offset: 31 -1;
            min: RSZMINW RSZMINH;
            align: 1.0 0.0;
            color: RSZCOL; // no cc
            fixed: 1 1;
            offscale;
         }
         desc { "hidden"; inherit: "default"; hid; }
      }
      rect {  "elm.event.resize.b";
         clip: "bottom_clip";
         scale: 1;
         desc { "default";
            rel1.to: "elm.event.resize.bl";
            rel1.relative: 1.0 0.0;
            rel2.to: "elm.event.resize.br";
            rel2.relative: 0.0 1.0;
            min: 0 RSZMINH;
            align: 0.5 0.0;
            color: RSZCOL2; // no cc
            fixed: 1 1;
            offscale;
         }
         desc { "hidden"; inherit: "default"; hid; }
      }
      rect {  "elm.event.resize.br";
         clip: "bottom_clip";
         scale: 1;
         desc { "default";
            rel.to: "bottom_clip";
            rel1.relative: 1.0 0.0;
            rel1.offset: -32 0;
            min: RSZMINW RSZMINH;
            align: 0.0 0.0;
            color: RSZCOL; // no cc
            fixed: 1 1;
            offscale;
         }
         desc { "hidden"; inherit: "default"; hid; }
      }
      rect { "indicator_bg";
         clip: "bg_clip";
         desc { "default";
            color: 148 23 45 255; // no cc never see this...
            rel.to: "elm.swallow.indicator";
         }
         desc { "bg_transparent";
            inherit: "default";
            color: 0 0 0 0; // no cc never see this...
         }
      }
      swallow { "elm.swallow.indicator";
         clip: "bg_clip";
         desc { "default";
            rel.to: "top_clip";
            rel1.relative: 0.0 1.0;
            visible: 0;
            align: 0.5 0.0;
            fixed: 1 1;
         }
         desc { "visible"; inherit: "default";
            visible: 1;
            fixed: 0 1;
         }
         desc { "hidden"; inherit: "visible";
            align: 0.5 1.0;
         }
      }
   }

   programs {
      program { signal: "elm,state,borderless,on"; source: "elm";
         action: STATE_SET "hidden";
         targets: "top_clip" "bottom_clip";
         after: "borderless,on";
      }
      program { "borderless,on"; SET_MODE(BORDERLESS); }
      program { signal: "elm,state,borderless,off"; source: "elm";
         action: STATE_SET "default";
         targets: "top_clip" "bottom_clip";
         after: "borderless,off";
      }
      program { "borderless,off"; UNSET_MODE(BORDERLESS); }
      program {
         signal: "elm,state,unresizable,on"; source: "elm";
         SET_MODE(UNRESIZABLE);
      }
      program { signal: "elm,state,unresizable,off"; source: "elm";
         UNSET_MODE(UNRESIZABLE);
      }
      program { signal: "elm,state,shadow,on"; source: "elm";
         script {
            set_int(hide_shadow, 0);
            eval_shadow_menu();
         }
//         action: STATE_SET "default";
//         target: "shadow_clip";
//         target: "shadow_base";
      }
      program { signal: "elm,state,shadow,off"; source: "elm";
         script {
            set_int(hide_shadow, 1);
            eval_shadow_menu();
         }
//         action: STATE_SET "hidden";
//         target: "shadow_clip";
//         target: "shadow_base";
      }
      /* application desktop menu */
      program { signal: "elm,action,show_menu"; source: "elm";
         script {
            set_int(show_menu, 1);
            eval_shadow_menu();
         }
//         action: STATE_SET "visible";
//         target: "elm.swallow.menu";
      }
      program { signal: "elm,action,hide"; source: "elm";
         script {
            set_int(show_menu, 0);
            eval_shadow_menu();
         }
//         action: STATE_SET "default";
//         target: "elm.swallow.menu";
      }
      program { signal: "elm,state,background,solid,on"; source: "elm";
         action: STATE_SET "visible";
         target: "elm.rect.background";
      }
      program { signal: "elm,state,background,solid,off"; source: "elm";
         action: STATE_SET "default";
         target: "elm.rect.background";
      }
//      program {
//         signal: "elm,state,background,standard,on"; source: "elm";
//         action: STATE_SET "visible";
//         target: "background_bevel";
//      }
//      program {
//         signal: "elm,state,background,standard,off"; source: "elm";
//         action: STATE_SET "default";
//         target: "background_bevel";
//      }
      program { signal: "elm,action,focus"; source: "elm";
         action: STATE_SET "focused";
         target: "top";
         target: "bottom";
         target: "elm.text.title";
         target: "clip1";
         target: "clip2";
         target: "shadow_clip";
      }
      program { signal: "elm,action,unfocus"; source: "elm";
         action: STATE_SET "default";
         target: "top";
         target: "bottom";
         target: "elm.text.title";
         target: "clip1";
         target: "clip2";
         target: "shadow_clip";
      }
      program { signal: "elm,state,urgent"; source: "elm";
         action: STATE_SET "bounce1";
         target: "icon";
         after: "urg1";
      }
      program { name: "urg1";
         action: STATE_SET "bounce2";
         transition: DECELERATE 0.4;
         target: "icon";
         after: "urg2";
      }
      program { name: "urg2";
         action: STATE_SET "bounce1";
         transition: ACCELERATE 0.3;
         target: "icon";
         after: "urg1";
      }
      program { signal: "elm,state,not_urgent"; source: "elm";
         action: STATE_SET "default";
         target: "icon";
      }

      /* maximize & unmaximize */
      program { signal: "elm,state,maximize*"; source: "elm";
         action: STATE_SET "max";
         target: "elm.spacer.opaque";
      }
      program { signal: "elm,state,maximize*"; source: "elm";
         SET_MODE(MAXIMIZED);
      }
      program { signal: "elm,state,unmaximize*"; source: "elm";
         action: STATE_SET "default";
         target: "elm.spacer.opaque";
      }
      program { signal: "elm,state,unmaximize*"; source: "elm";
         UNSET_MODE(MAXIMIZED);
      }

      /*indicator*/
      program { signal: "elm,action,show_indicator"; source: "elm";
         script {
            set_int(indicator_enabled, 1);
         }
         after: "update_indicator";
      }
      program { signal: "elm,action,hide_indicator"; source: "elm";
         script {
            set_int(indicator_enabled, 0);
         }
         after: "update_indicator";
      }
      program { signal: "elm,action,indicator,bg_opaque"; source: "elm";
         script {
            set_int(indicator_type, INDICATOR_TYPE_BG_OPAQUE);
         }
         after: "update_indicator";
      }
      program { signal: "elm,action,indicator,bg_transparent"; source: "elm";
         script {
            set_int(indicator_type, INDICATOR_TYPE_BG_TRANSPARENT);
         }
         after: "update_indicator";
      }
      program { signal: "elm,action,indicator,hidden"; source: "elm";
         script {
            set_int(indicator_type, INDICATOR_TYPE_HIDDEN);
         }
         after: "update_indicator";
      }
      program { signal: "elm,action,indicator,show_effect"; source: "elm";
         action: STATE_SET "visible";
         transition: DECELERATE 0.2;
         target: "elm.swallow.indicator";
      }
      program { signal: "elm,action,indicator,hide_effect"; source: "elm";
         action: STATE_SET "hidden";
         transition: DECELERATE 0.2;
         target: "elm.swallow.indicator";
      }
      program { name: "update_indicator";
         script {
            if (get_int(indicator_enabled)) {
              if ((get_int(indicator_type) == INDICATOR_TYPE_BG_OPAQUE) ||
                  (get_int(indicator_type) == INDICATOR_TYPE_UNKNOWN)) {
                set_state(PART:"elm.swallow.indicator", "visible", 0.0);
                set_state(PART:"indicator_spacer", "default", 0.0);
                set_state(PART:"indicator_bg", "default", 0.0);
              } else if (get_int(indicator_type) == INDICATOR_TYPE_BG_TRANSPARENT) {
                set_state(PART:"elm.swallow.indicator", "visible", 0.0);
                set_state(PART:"indicator_spacer", "default", 0.0);
                set_state(PART:"indicator_bg", "bg_transparent", 0.0);
              } else if (get_int(indicator_type) == INDICATOR_TYPE_HIDDEN) {
                set_state(PART:"elm.swallow.indicator", "hidden", 0.0);
                set_state(PART:"indicator_spacer", "hidden", 0.0);
                set_state(PART:"indicator_bg", "default", 0.0);
              }
            } else {
              set_state(PART:"elm.swallow.indicator", "default", 0.0);
              set_state(PART:"indicator_spacer", "default", 0.0);
            }
         }
      }

      /* modal windows */
      program { signal: "elm,action,hide_blocker"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "elm.rect.blocker";
         transition: DECELERATE 0.2;
      }
      program { signal: "elm,action,show_blocker"; source: "elm";
         action: STATE_SET "visible" 0.0;
         target: "elm.rect.blocker";
         transition: DECELERATE 0.2;
      }

      /* minimize, maximize & close buttons */
      program { signal: "mouse,down,*"; source: "elm.event.close";
         action: STATE_SET "selected";
         target: "close1";
         target: "close2";
      }
      program { signal: "mouse,up,*"; source: "elm.event.close";
         action: STATE_SET "default";
         target: "close1";
         target: "close2";
      }
      program { signal: "mouse,down,*"; source: "elm.event.maximize";
         action: STATE_SET "selected";
         target: "max1";
         target: "max2";
      }
      program { signal: "mouse,up,*"; source: "elm.event.maximize";
         action: STATE_SET "default";
         target: "max1";
         target: "max2";
      }
      program { signal: "mouse,down,*"; source: "elm.event.minimize";
         action: STATE_SET "selected";
         target: "min1";
         target: "min2";
      }
      program { signal: "mouse,up,*"; source: "elm.event.minimize";
         action: STATE_SET "default";
         target: "min1";
         target: "min2";
      }
      program { signal: "mouse,down,1"; source: "elm.event.titlebar";
         action: SIGNAL_EMIT "elm,action,move,start" "elm";
      }
      program { signal: "mouse,up,1"; source: "elm.event.titlebar";
         action: SIGNAL_EMIT "elm,action,move,stop" "elm";
      }
      program { signal: "mouse,clicked,1"; source: "elm.event.minimize";
         action: SIGNAL_EMIT "elm,action,minimize" "elm";
      }
      program { signal: "mouse,clicked,1"; source: "elm.event.maximize";
         action: SIGNAL_EMIT "elm,action,maximize" "elm";
      }
      program { signal: "mouse,clicked,1"; source: "elm.event.close";
         action: SIGNAL_EMIT "elm,action,close" "elm";
      }
      program { signal: "mouse,in"; source: "elm.event.resize.t";
         action: SIGNAL_EMIT "elm,action,resize,show" "elm.event.resize.t";
      }
      program { signal: "mouse,out"; source: "elm.event.resize.t";
         action: SIGNAL_EMIT "elm,action,resize,hide" "elm.event.resize.t";
      }
      program { signal: "mouse,down,1"; source: "elm.event.resize.t";
         action: SIGNAL_EMIT "elm,action,resize,start" "elm.event.resize.t";
      }
      program { signal: "mouse,in"; source: "elm.event.resize.b";
         action: SIGNAL_EMIT "elm,action,resize,show" "elm.event.resize.b";
      }
      program { signal: "mouse,out"; source: "elm.event.resize.b";
         action: SIGNAL_EMIT "elm,action,resize,hide" "elm.event.resize.b";
      }
      program { signal: "mouse,down,1"; source: "elm.event.resize.b";
         action: SIGNAL_EMIT "elm,action,resize,start" "elm.event.resize.b";
      }
      program { signal: "mouse,in"; source: "elm.event.resize.tl";
         action: SIGNAL_EMIT "elm,action,resize,show" "elm.event.resize.tl";
      }
      program { signal: "mouse,out"; source: "elm.event.resize.tl";
         action: SIGNAL_EMIT "elm,action,resize,hide" "elm.event.resize.tl";
      }
      program { signal: "mouse,down,1"; source: "elm.event.resize.tl";
         action: SIGNAL_EMIT "elm,action,resize,start" "elm.event.resize.tl";
      }
      program { signal: "mouse,in"; source: "elm.event.resize.tr";
         action: SIGNAL_EMIT "elm,action,resize,show" "elm.event.resize.tr";
      }
      program { signal: "mouse,out"; source: "elm.event.resize.tr";
         action: SIGNAL_EMIT "elm,action,resize,hide" "elm.event.resize.tr";
      }
      program { signal: "mouse,down,1"; source: "elm.event.resize.tr";
         action: SIGNAL_EMIT "elm,action,resize,start" "elm.event.resize.tr";
      }
      program { signal: "mouse,in"; source: "elm.event.resize.bl";
         action: SIGNAL_EMIT "elm,action,resize,show" "elm.event.resize.bl";
      }
      program { signal: "mouse,out"; source: "elm.event.resize.bl";
         action: SIGNAL_EMIT "elm,action,resize,hide" "elm.event.resize.bl";
      }
      program { signal: "mouse,down,1"; source: "elm.event.resize.bl";
         action: SIGNAL_EMIT "elm,action,resize,start" "elm.event.resize.bl";
      }
      program { signal: "mouse,in"; source: "elm.event.resize.br";
         action: SIGNAL_EMIT "elm,action,resize,show" "elm.event.resize.br";
      }
      program { signal: "mouse,out"; source: "elm.event.resize.br";
         action: SIGNAL_EMIT "elm,action,resize,hide" "elm.event.resize.br";
      }
      program { signal: "mouse,down,1"; source: "elm.event.resize.br";
         action: SIGNAL_EMIT "elm,action,resize,start" "elm.event.resize.br";
      }
      program { signal: "mouse,clicked,1"; source: "elm.event.icon";
         action: SIGNAL_EMIT "elm,action,menu" "elm";
      }
   }
}

group { name: "elm/border/dialog/default";
   inherit:   "elm/border/base/default";
   parts {
      text {  "elm.text.title";
         clip: "top_clip";
         desc { "default";
            rel2.to_x: "elm.event.close";
         }
         desc { "focused";
            inherit: "default";
            visible: 0;
         }
      }
      text {  "title2";
         desc { "default";
            rel2.to_x: "elm.event.close";
         }
         desc { "focused";
            inherit: "default";
            visible: 1;
         }
      }
      image { "max1";
         desc { "default";
            visible: 0;
         }
         desc { "selected";
            visible: 0;
         }
      }
      image { "min1";
         desc { "default";
            visible: 0;
         }
         desc { "selected";
            visible: 0;
         }
      }
      image { "max2";
         desc { "default";
            visible: 0;
         }
         desc { "selected";
            visible: 0;
         }
      }
      image { "min2";
         desc { "default";
            visible: 0;
         }
         desc { "selected";
            visible: 0;
         }
      }
      rect {  "elm.event.maximize";
         desc { "default";
            visible: 0;
         }
      }
      rect {  "elm.event.minimize";
         desc { "default";
            visible: 0;
         }
      }
   }
}

group { name: "elm/border/naviframe/default";
   inherit:   "elm/border/dialog/default";
   parts {
      image { "close1";
         desc { "default";
            image.normal: "i-arrow-l";
         }
         desc { "selected";
            image.normal: "i-arrow-l";
         }
      }
      image { "close2"; nomouse;
         clip: "clip2";
         desc { "default";
            image.normal: "i-arrow-l";
         }
         desc { "selected";
            image.normal: "i-arrow-l";
         }
      }
   }
}

#undef UNRESIZABLE
#undef BORDERLESS
#undef MAXIMIZED
#undef SET_MODE
#undef UNSET_MODE

